<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<style>
    .shuoming{position: absolute;top: 14px;left: 90px;color: #aaa}
</style>
<body class="laytp-container">
<div id="opt_nav">
    <ul class="layui-nav">
    </ul>
</div>
<div class="layui-card">
    <div class="layui-card-body" style="margin-left: 10px !important;">
        <form class="layui-form layui-form-pane" id="commentForm">
            <div class="main-container" style="margin-left: 0 !important;padding-top: 20px !important;">
                <div class="block-first">
                    <div class="layui-form-item">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md12">
                                <label class="layui-form-label" style="height: 53px;">单点登录</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" id="issingle" disabled lay-skin="switch" lay-filter="issingle" lay-text="开启|关闭" class="layui-input">
                                    <span class="shuoming">如开启，不允许同一账号在多台设备同时登录使用</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md12">
                                <label class="layui-form-label" style="height: 53px;">是否需总监审核</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" id="isjian" disabled lay-skin="switch" lay-filter="isjian" lay-text="开启|关闭" class="layui-input">
                                    <span class="shuoming">如开启，文件上报及现场填报都需要先经由监理审批（施工单位/设计单位/勘察单位/运营单位/供应商单位/制造商单位）</span>
                                </div>
                            </div>
                        </div>
<!--                        <div class="layui-row layui-col-space10">-->
<!--                            <div class="layui-col-md12">-->
<!--                                <label class="layui-form-label" style="height: 53px;">是否统计文件数量</label>-->
<!--                                <div class="layui-input-block">-->
<!--                                    <input type="checkbox" id="iskutong" disabled lay-skin="switch" lay-filter="iskutong" lay-text="开启|关闭" class="layui-input">-->
<!--                                    <span class="shuoming">如开启，文件资料库的文件夹后会显示上传文件数量（此功能会影响打开速度）</span>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md12">
                                <label class="layui-form-label" style="height: 54px;">是否统计文件数量</label>
                                <div class="layui-input-block">
                                    <select id="iskutong" name="iskutong" lay-filter="iskutong" >
                                        <option value="1">完全统计(影响速度)</option>
                                        <option value="2">简易统计(推荐)</option>
                                        <option value="0">不统计</option>
                                    </select>
                                </div>
                            </div>
                        </div>


<!--                        <div class="layui-row layui-col-space10">-->
<!--                            <div class="layui-col-md6">-->
<!--                                <label class="layui-form-label" style="height: 38px;">流程手动签名</label>-->
<!--                                <div class="layui-input-block" style="border:1px solid #ccc">-->
<!--                                    <select id="isqian" name="isqian" lay-filter="isqian" ></select>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['laytp','button'], function() {
        var form = layui.form;

        facade.ajax({type:'get', url: ask_company_can}).done(function(res){
            if (res['code'] === 2000) {
                var data = res.data;

                if(data.issingle < 1){
                    $("#issingle").attr('checked','checked');
                }

                if(data.butauth.length > 0){
                    $("#issingle").attr('disabled',false);
                }

                if(data.isjian > 0){
                    $("#isjian").attr('checked','checked');
                }

                if(data.butauth.length > 0){
                    $("#isjian").attr('disabled',false);
                }


                $("#iskutong").val(data.iskutong);



                // var isqian_str = '';
                // var isqianarr = res.data.isqianarr;
                // for (var key in isqianarr){
                //     if(data.isqian == key){
                //         isqian_str += '<option value="'+key+'" selected>'+isqianarr[key]+'</option>';
                //     }else{
                //         isqian_str += '<option value="'+key+'">'+isqianarr[key]+'</option>';
                //     }
                // }
                // $("#isqian").html(isqian_str);

            }
            render_from();
        });

        form.on('switch(issingle)', function(data){
            facade.ajax({url: ask_company_can, data:{issingle:data.elem.checked ? 0 : 1}}).done(function(res){
                if (res['code'] === 2000) {
                    window.location.reload();
                }
            });
        });

        form.on('switch(isjian)', function(data){
            facade.ajax({url: ask_company_can, data:{isjian:data.elem.checked ? 1 : 0}}).done(function(res){
                if (res['code'] === 2000) {
                    window.location.reload();
                }
            });
        });
        form.on('switch(iskutong)', function(data){
            facade.ajax({url: ask_company_can, data:{iskutong:data.elem.checked ? 1 : 0}}).done(function(res){
                if (res['code'] === 2000) {
                    window.location.reload();
                }
            });
        });
        // form.on('select(isqian)', function(data){
        //     facade.ajax({url: ask_company_can, data:{isqian:data.value}}).done(function(res){
        //         if (res['code'] === 2000) {
        //             window.location.reload();
        //         }
        //     });
        // });

        form.on('select(iskutong)', function(data){
            facade.ajax({url: ask_company_can, data:{iskutong:data.value}}).done(function(res){
                if (res['code'] === 2000) {
                    window.location.reload();
                }
            });
        });

    });
</script>
</body>
</html>
